package cn.hehuoren.quartz.service;


import cn.hehuoren.quartz.model.QuartzManager;
import cn.hehuoren.core.utils.GridModel;

import java.util.List;


public interface IQuartzManagerService {
	/**
	 * 查询调度任务信息
	 * @param start
	 * @param num
	 * @param dtlSchedName
	 * @param dtlJobName
	 * @param dtlJobGroup
	 * @param dtlDescription
     * @return
     */
	List<QuartzManager> select(Integer start, Integer num, String dtlSchedName,
							   String dtlJobName, String dtlJobGroup, String dtlDescription);

	QuartzManager getByKey(String dtlSchedName, String dtlJobName,
                           String dtlJobGroup);

	int getTotal(Integer start, Integer num, String dtlSchedName,
                 String dtlJobName, String dtlJobGroup, String dtlDescription);

	int deleteQrtzJobDetails(QuartzManager quartzManager);

	int deleteQrtzTriggers(QuartzManager quartzManager);

	int deleteQrtzCronTriggers(QuartzManager quartzManager);

	int runSingleTime(String trigTriggerName, String trigTriggerGroup);

	String checkJobIsComplete(String trigTriggerName, String trigTriggerGroup);
	
	/**
     * 删除job任务
     * @param quartzManager
     * @return
     */
    //public boolean deleteJobFromDB(QuartzManager quartz) throws SchedulerException;
    
    public GridModel<QuartzManager> selectQuartzManagerPage(QuartzManager quartzManager, int pageNum, int pageSize, String orderStr);
    
    public void addQuarzTask(QuartzManager quartzManager);
    
    public boolean deleteJob(QuartzManager quartzManager);
    
    public void pauseJob(QuartzManager quartzManager);
    
    public void resumeJob(QuartzManager quartzManager);
    
    public boolean interrupt(QuartzManager quartzManager);
    
    public void triggerJob(QuartzManager quartzManager);
    
    public void pauseJob();
    
    public void shutdownScheduler();
    
    public void updateQuarzTask(QuartzManager quartzManager);
}
